import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.Demo.dao.impl.*;

public class DItest {
    /**
     * 使用setter注入简单值
     */
    @Test
    void testSetter() {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        System.out.println("==============以下是测试setter=========================");
        Customer customer = applicationContext.getBean("customer", Customer.class);
        customer.display();
    }
    /**
     * 使用Java注入简单值
     */
    @Test
    void testJava(){
        ApplicationContext context = new AnnotationConfigApplicationContext(HelloJava.class);
        System.out.println("==============以下是测试java=========================");
        HelloJava java = context.getBean(HelloJava.class);
        java.display();
    }
    /**
     * 使用依赖注入简单值
     */
    @Test
    void testQualifier(){
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        System.out.println("==============以下是测试Qualifier=========================");
        Study study = context.getBean("study", Study.class);
        study.display();
    }
}
